import { ChannelItem } from "../../types/data";
import { ChannelAction } from "../../types/store";
interface IState {
  channels: ChannelItem[];
  active: number;
}
const initValue: IState = {
  channels: [],
  active: 0,
};
export default function channel(state = initValue, action: ChannelAction) {
  switch (action.type) {
    case "CHANNEL_SAVE":
      return {
        ...state,
        channels: action.payload,
      };
    case "CHANNEL_ACTIVE":
      return {
        ...state,
        active:action.id
      };
    default:
      return state;
  }
}
